package com.machine.filling.base.baseMvp;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.machine.filling.base.IView;


/**
 * Created by sperfan on 2017/11/27.
 *
 * @描述:
 */

public abstract class BaseFragment<T extends IBasePresenter> extends Fragment implements IView,IBaseView<T> {
    public Activity mActivity;
    public Context mContext;
    public Intent fragmentIntent;//此intent为 fragment之间传递数据的媒介
    protected Intent mIntent;
    public T mPresenter;

    public BaseFragment() {
    }

    /**
     *
     * @param mIntent
     */
    public BaseFragment(Intent mIntent) {
        this.fragmentIntent = mIntent;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        mActivity = getActivity();
        mContext = getContext();
        mIntent = mActivity.getIntent();
        View contentView = initViews();
        initDatas();
        return contentView;
    }


    @Override
    public void showProgress(String loadingStr) {

    }

    @Override
    public void hideProgress() {

    }

    @Override
    public void setPresenter(T presenter) {
        mPresenter = presenter;
    }
}
